<template>
  <div class="bindUsers-container">
    <div class="select-box">
      <van-search v-model="keyword" show-action placeholder="请输入姓名">
        <template #action>
          <div @click="onSearch">搜索</div>
        </template>
      </van-search>
    </div>
    <div class="list-group1 scrollbar">
      <div class="list-box" v-for="(item,index) in dataList" :key="index">
        <div class="list-header">
          <div class="list-header-icon">
            <span class="icon" :class="'icon'+index" v-if="index<3"></span>
            <span>第{{index+1}}名</span>
          </div>
          <div>{{item.uname}}</div>
        </div>
        <div class="demo-preview">
          <div class="row-s">
            <div class="col-s"></div>
            <div class="col-s">今日</div>
            <div class="col-s">昨日</div>
            <div class="col-s">本周</div>
            <div class="col-s">本月</div>
            <div class="col-s">合计</div>
          </div>
          <div class="row-s">
            <div class="col-s">B级</div>
            <div class="col-s">{{item.L1_todaydata}}</div>
            <div class="col-s">{{item.L1_yesterdaydata}}</div>
            <div class="col-s">{{item.L1_weekdata}}</div>
            <div class="col-s">{{item.L1_monthdata}}</div>
            <div class="col-s">{{item.L1_total}}</div>
          </div>
          <div class="row-s">
            <div class="col-s">C级</div>
            <div class="col-s">{{item.L2_todaydata}}</div>
            <div class="col-s">{{item.L2_yesterdaydata}}</div>
            <div class="col-s">{{item.L2_weekdata}}</div>
            <div class="col-s">{{item.L2_monthdata}}</div>
            <div class="col-s">{{item.L2_total}}</div>
          </div>
        </div>
      </div>
      <empty description="暂无内容" v-if="dataList.length<=0"></empty>
    </div>
  </div>
</template>
  <script>
import * as echarts from 'echarts';
import { Icon, Grid, GridItem, Cell, Calendar, Search, Switch } from 'vant';
export default {
  components: {
    [Icon.name]: Icon, [Grid.name]: Grid, [GridItem.name]: GridItem, [Cell.name]: Cell,
    [Calendar.name]: Calendar, [Search.name]: Search, [Switch.name]: Switch
  },
  data() {
    return {
      active: 0,
      date: '请选择',
      keyword: '',
      checked: false,
      loading: false,
      dataList: [],
      startTime: '',
      endTime: '',
      tabTitle: 'bytoday',
      tabIndex: 0,
      height: 500
    };
  },

  created() {
    this.id = this.$route.query.id;//作业id
    this.initAjaxMethod();
  },
  methods: {
    initAjaxMethod() {
      const toast = this.$toast.loading("加载中...");
      this.$http
        .post(this.$API.GET_PEROFFICE_BINDUSERS, { keyword: this.keyword })
        .then((data) => {
          toast.clear();
          if (data.code == 1) {
            let list = Array.isArray(data.list) ? data.list : [];
            this.dataList=list;
            // this.dataList = Array.isArray(res.list) ? res.data : [];
          }
        });
    },
    onSearch() {
      this.initAjaxMethod();
    }
  }
};
  </script>
  
  <style lang="less">
.bindUsers-container {
  .select-box {
    padding: 0 0.3rem;
    background: #fff;
    .van-cell {
      line-height: 0.6rem;
    }
    .van-search__action {
      font-size:0.3rem;
    }
  }
  .list-group1 {
    padding: 0.3rem;
    height: 86vh;
  }
  .list-box {
    background: #fff;
    border-radius: 0.2rem;
    box-shadow: 1px 1px 5px -3px #000;
    overflow: hidden;
    margin-bottom: 0.2rem;
  }
  .list-header {
    height: 1rem;
    line-height: 1rem;
    background: #fafafa;
    padding: 0 0.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size:0.32rem;
  }
  .list-header-icon {
    display: flex;
    align-items: center;
  }
  .van-col {
    height: 0.72rem;
    line-height: 0.72rem;
    font-size: 0.3rem;
    text-align: center;
  }
  .demo-preview {
    padding: 0.2rem 0.3rem;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  }
  .demo-preview img {
    flex-shrink: 0;
    width: 0.64rem;
    height: 0.64rem;
    margin-right: 16px;
    background: #eee;
    border-radius: 50%;
  }
  .demo-content {
    padding-top: 0.12rem;
  }
  .demo-text {
    margin: 0.12rem 0 0;
    font-size: 0.3rem;
    line-height: 0.4rem;
  }
  .list-boxs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 0.8rem;
    line-height: 0.8rem;
    padding: 0 0.3rem;
  }
  .list-boxs span {
    font-size: 0.3rem;
    color: #888;
  }
  .detail-btn {
    padding: 0 15px;
    height: 0.6rem;
    line-height: 0.6rem;
    border-radius: 0.48rem;
    font-size: 0.28rem;
    color: #fff;
    background: rgb(255, 153, 0);
    font-style: normal;
  }
  .row-s {
    display: flex;
    align-items: center;
  }
  .col-s {
    height: 0.72rem;
    line-height: 0.72rem;
    font-size: 0.3rem;
    text-align: center;
    width: 16.66%;
  }
  .row-s:nth-of-type(even) {
    background: #ccffff;
  }
  .icon {
    width: 0.4rem;
    height: 0.56rem;
    margin-right: 0.12rem;
  }
  .icon0{
      background: url("../../../../assets/img/frist_icon1.png") center no-repeat;
      background-size: 100% 100%;
  }
  .icon1{
      background: url("../../../../assets/img/second_icon.png") center no-repeat;
      background-size: 100% 100%;
  }
  .icon2{
      background: url("../../../../assets/img/san_icon.png") center no-repeat;
      background-size: 100% 100%;
  }
}
</style>